// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Network Connectivity API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
/// let client = CrossNetworkAutomationService::builder().build().await?;
/// // use `client` to make requests to the Network Connectivity API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The service for CrossNetworkAutomation resources.
///
/// # Configuration
///
/// To configure `CrossNetworkAutomationService` use the `with_*` methods in the type returned
/// by [builder()][CrossNetworkAutomationService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://networkconnectivity.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::cross_network_automation_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::cross_network_automation_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `CrossNetworkAutomationService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `CrossNetworkAutomationService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct CrossNetworkAutomationService {
    inner: std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
}

impl CrossNetworkAutomationService {
    /// Returns a builder for [CrossNetworkAutomationService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
    /// let client = CrossNetworkAutomationService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::cross_network_automation_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::cross_network_automation_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::CrossNetworkAutomationService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::CrossNetworkAutomationService> {
        super::transport::CrossNetworkAutomationService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::CrossNetworkAutomationService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::CrossNetworkAutomationService::new)
    }

    /// Lists ServiceConnectionMaps in a given project and location.
    pub fn list_service_connection_maps(
        &self,
    ) -> super::builder::cross_network_automation_service::ListServiceConnectionMaps {
        super::builder::cross_network_automation_service::ListServiceConnectionMaps::new(
            self.inner.clone(),
        )
    }

    /// Gets details of a single ServiceConnectionMap.
    pub fn get_service_connection_map(
        &self,
    ) -> super::builder::cross_network_automation_service::GetServiceConnectionMap {
        super::builder::cross_network_automation_service::GetServiceConnectionMap::new(
            self.inner.clone(),
        )
    }

    /// Creates a new ServiceConnectionMap in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_service_connection_map(
        &self,
    ) -> super::builder::cross_network_automation_service::CreateServiceConnectionMap {
        super::builder::cross_network_automation_service::CreateServiceConnectionMap::new(
            self.inner.clone(),
        )
    }

    /// Updates the parameters of a single ServiceConnectionMap.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_service_connection_map(
        &self,
    ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionMap {
        super::builder::cross_network_automation_service::UpdateServiceConnectionMap::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single ServiceConnectionMap.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_service_connection_map(
        &self,
    ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionMap {
        super::builder::cross_network_automation_service::DeleteServiceConnectionMap::new(
            self.inner.clone(),
        )
    }

    /// Lists ServiceConnectionPolicies in a given project and location.
    pub fn list_service_connection_policies(
        &self,
    ) -> super::builder::cross_network_automation_service::ListServiceConnectionPolicies {
        super::builder::cross_network_automation_service::ListServiceConnectionPolicies::new(
            self.inner.clone(),
        )
    }

    /// Gets details of a single ServiceConnectionPolicy.
    pub fn get_service_connection_policy(
        &self,
    ) -> super::builder::cross_network_automation_service::GetServiceConnectionPolicy {
        super::builder::cross_network_automation_service::GetServiceConnectionPolicy::new(
            self.inner.clone(),
        )
    }

    /// Creates a new ServiceConnectionPolicy in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_service_connection_policy(
        &self,
    ) -> super::builder::cross_network_automation_service::CreateServiceConnectionPolicy {
        super::builder::cross_network_automation_service::CreateServiceConnectionPolicy::new(
            self.inner.clone(),
        )
    }

    /// Updates the parameters of a single ServiceConnectionPolicy.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_service_connection_policy(
        &self,
    ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy {
        super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single ServiceConnectionPolicy.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_service_connection_policy(
        &self,
    ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy {
        super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy::new(
            self.inner.clone(),
        )
    }

    /// Lists ServiceClasses in a given project and location.
    pub fn list_service_classes(
        &self,
    ) -> super::builder::cross_network_automation_service::ListServiceClasses {
        super::builder::cross_network_automation_service::ListServiceClasses::new(
            self.inner.clone(),
        )
    }

    /// Gets details of a single ServiceClass.
    pub fn get_service_class(
        &self,
    ) -> super::builder::cross_network_automation_service::GetServiceClass {
        super::builder::cross_network_automation_service::GetServiceClass::new(self.inner.clone())
    }

    /// Updates the parameters of a single ServiceClass.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_service_class(
        &self,
    ) -> super::builder::cross_network_automation_service::UpdateServiceClass {
        super::builder::cross_network_automation_service::UpdateServiceClass::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single ServiceClass.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_service_class(
        &self,
    ) -> super::builder::cross_network_automation_service::DeleteServiceClass {
        super::builder::cross_network_automation_service::DeleteServiceClass::new(
            self.inner.clone(),
        )
    }

    /// Gets details of a single ServiceConnectionToken.
    pub fn get_service_connection_token(
        &self,
    ) -> super::builder::cross_network_automation_service::GetServiceConnectionToken {
        super::builder::cross_network_automation_service::GetServiceConnectionToken::new(
            self.inner.clone(),
        )
    }

    /// Lists ServiceConnectionTokens in a given project and location.
    pub fn list_service_connection_tokens(
        &self,
    ) -> super::builder::cross_network_automation_service::ListServiceConnectionTokens {
        super::builder::cross_network_automation_service::ListServiceConnectionTokens::new(
            self.inner.clone(),
        )
    }

    /// Creates a new ServiceConnectionToken in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_service_connection_token(
        &self,
    ) -> super::builder::cross_network_automation_service::CreateServiceConnectionToken {
        super::builder::cross_network_automation_service::CreateServiceConnectionToken::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single ServiceConnectionToken.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_service_connection_token(
        &self,
    ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionToken {
        super::builder::cross_network_automation_service::DeleteServiceConnectionToken::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(
        &self,
    ) -> super::builder::cross_network_automation_service::ListLocations {
        super::builder::cross_network_automation_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::cross_network_automation_service::GetLocation {
        super::builder::cross_network_automation_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::cross_network_automation_service::SetIamPolicy {
        super::builder::cross_network_automation_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::cross_network_automation_service::GetIamPolicy {
        super::builder::cross_network_automation_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::cross_network_automation_service::TestIamPermissions {
        super::builder::cross_network_automation_service::TestIamPermissions::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(
        &self,
    ) -> super::builder::cross_network_automation_service::ListOperations {
        super::builder::cross_network_automation_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::cross_network_automation_service::GetOperation {
        super::builder::cross_network_automation_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::cross_network_automation_service::DeleteOperation {
        super::builder::cross_network_automation_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::cross_network_automation_service::CancelOperation {
        super::builder::cross_network_automation_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Network Connectivity API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
/// let client = DataTransferService::builder().build().await?;
/// // use `client` to make requests to the Network Connectivity API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// DataTransferService is the service for the Data Transfer API.
///
/// # Configuration
///
/// To configure `DataTransferService` use the `with_*` methods in the type returned
/// by [builder()][DataTransferService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://networkconnectivity.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::data_transfer_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::data_transfer_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DataTransferService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `DataTransferService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct DataTransferService {
    inner: std::sync::Arc<dyn super::stub::dynamic::DataTransferService>,
}

impl DataTransferService {
    /// Returns a builder for [DataTransferService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
    /// let client = DataTransferService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::data_transfer_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::data_transfer_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DataTransferService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DataTransferService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataTransferService> {
        super::transport::DataTransferService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataTransferService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DataTransferService::new)
    }

    /// Lists the `MulticloudDataTransferConfig` resources in a specified project
    /// and location.
    pub fn list_multicloud_data_transfer_configs(
        &self,
    ) -> super::builder::data_transfer_service::ListMulticloudDataTransferConfigs {
        super::builder::data_transfer_service::ListMulticloudDataTransferConfigs::new(
            self.inner.clone(),
        )
    }

    /// Gets the details of a `MulticloudDataTransferConfig` resource.
    pub fn get_multicloud_data_transfer_config(
        &self,
    ) -> super::builder::data_transfer_service::GetMulticloudDataTransferConfig {
        super::builder::data_transfer_service::GetMulticloudDataTransferConfig::new(
            self.inner.clone(),
        )
    }

    /// Creates a `MulticloudDataTransferConfig` resource in a specified project
    /// and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_multicloud_data_transfer_config(
        &self,
    ) -> super::builder::data_transfer_service::CreateMulticloudDataTransferConfig {
        super::builder::data_transfer_service::CreateMulticloudDataTransferConfig::new(
            self.inner.clone(),
        )
    }

    /// Updates a `MulticloudDataTransferConfig` resource in a specified project
    /// and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_multicloud_data_transfer_config(
        &self,
    ) -> super::builder::data_transfer_service::UpdateMulticloudDataTransferConfig {
        super::builder::data_transfer_service::UpdateMulticloudDataTransferConfig::new(
            self.inner.clone(),
        )
    }

    /// Deletes a `MulticloudDataTransferConfig` resource.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_multicloud_data_transfer_config(
        &self,
    ) -> super::builder::data_transfer_service::DeleteMulticloudDataTransferConfig {
        super::builder::data_transfer_service::DeleteMulticloudDataTransferConfig::new(
            self.inner.clone(),
        )
    }

    /// Lists the `Destination` resources in a specified project and location.
    pub fn list_destinations(&self) -> super::builder::data_transfer_service::ListDestinations {
        super::builder::data_transfer_service::ListDestinations::new(self.inner.clone())
    }

    /// Gets the details of a `Destination` resource.
    pub fn get_destination(&self) -> super::builder::data_transfer_service::GetDestination {
        super::builder::data_transfer_service::GetDestination::new(self.inner.clone())
    }

    /// Creates a `Destination` resource in a specified project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_destination(&self) -> super::builder::data_transfer_service::CreateDestination {
        super::builder::data_transfer_service::CreateDestination::new(self.inner.clone())
    }

    /// Updates a `Destination` resource in a specified project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_destination(&self) -> super::builder::data_transfer_service::UpdateDestination {
        super::builder::data_transfer_service::UpdateDestination::new(self.inner.clone())
    }

    /// Deletes a `Destination` resource.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_destination(&self) -> super::builder::data_transfer_service::DeleteDestination {
        super::builder::data_transfer_service::DeleteDestination::new(self.inner.clone())
    }

    /// Gets the details of a service that is supported for Data Transfer
    /// Essentials.
    pub fn get_multicloud_data_transfer_supported_service(
        &self,
    ) -> super::builder::data_transfer_service::GetMulticloudDataTransferSupportedService {
        super::builder::data_transfer_service::GetMulticloudDataTransferSupportedService::new(
            self.inner.clone(),
        )
    }

    /// Lists the services in the project for a region that are supported for
    /// Data Transfer Essentials.
    pub fn list_multicloud_data_transfer_supported_services(
        &self,
    ) -> super::builder::data_transfer_service::ListMulticloudDataTransferSupportedServices {
        super::builder::data_transfer_service::ListMulticloudDataTransferSupportedServices::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::data_transfer_service::ListLocations {
        super::builder::data_transfer_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::data_transfer_service::GetLocation {
        super::builder::data_transfer_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::data_transfer_service::SetIamPolicy {
        super::builder::data_transfer_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::data_transfer_service::GetIamPolicy {
        super::builder::data_transfer_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::data_transfer_service::TestIamPermissions {
        super::builder::data_transfer_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::data_transfer_service::ListOperations {
        super::builder::data_transfer_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::data_transfer_service::GetOperation {
        super::builder::data_transfer_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::data_transfer_service::DeleteOperation {
        super::builder::data_transfer_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::data_transfer_service::CancelOperation {
        super::builder::data_transfer_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Network Connectivity API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_networkconnectivity_v1::client::HubService;
/// let client = HubService::builder().build().await?;
/// // use `client` to make requests to the Network Connectivity API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Network Connectivity Center is a hub-and-spoke abstraction for network
/// connectivity management in Google Cloud. It reduces operational complexity
/// through a simple, centralized connectivity management model.
///
/// # Configuration
///
/// To configure `HubService` use the `with_*` methods in the type returned
/// by [builder()][HubService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://networkconnectivity.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::hub_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::hub_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `HubService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `HubService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct HubService {
    inner: std::sync::Arc<dyn super::stub::dynamic::HubService>,
}

impl HubService {
    /// Returns a builder for [HubService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_networkconnectivity_v1::client::HubService;
    /// let client = HubService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::hub_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::hub_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::HubService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::HubService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::HubService> {
        super::transport::HubService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::HubService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::HubService::new)
    }

    /// Lists the Network Connectivity Center hubs associated with a given project.
    pub fn list_hubs(&self) -> super::builder::hub_service::ListHubs {
        super::builder::hub_service::ListHubs::new(self.inner.clone())
    }

    /// Gets details about a Network Connectivity Center hub.
    pub fn get_hub(&self) -> super::builder::hub_service::GetHub {
        super::builder::hub_service::GetHub::new(self.inner.clone())
    }

    /// Creates a new Network Connectivity Center hub in the specified project.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_hub(&self) -> super::builder::hub_service::CreateHub {
        super::builder::hub_service::CreateHub::new(self.inner.clone())
    }

    /// Updates the description and/or labels of a Network Connectivity Center
    /// hub.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_hub(&self) -> super::builder::hub_service::UpdateHub {
        super::builder::hub_service::UpdateHub::new(self.inner.clone())
    }

    /// Deletes a Network Connectivity Center hub.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_hub(&self) -> super::builder::hub_service::DeleteHub {
        super::builder::hub_service::DeleteHub::new(self.inner.clone())
    }

    /// Lists the Network Connectivity Center spokes associated with a
    /// specified hub and location. The list includes both spokes that are attached
    /// to the hub and spokes that have been proposed but not yet accepted.
    pub fn list_hub_spokes(&self) -> super::builder::hub_service::ListHubSpokes {
        super::builder::hub_service::ListHubSpokes::new(self.inner.clone())
    }

    /// Query the Private Service Connect propagation status of a Network
    /// Connectivity Center hub.
    pub fn query_hub_status(&self) -> super::builder::hub_service::QueryHubStatus {
        super::builder::hub_service::QueryHubStatus::new(self.inner.clone())
    }

    /// Lists the Network Connectivity Center spokes in a specified project and
    /// location.
    pub fn list_spokes(&self) -> super::builder::hub_service::ListSpokes {
        super::builder::hub_service::ListSpokes::new(self.inner.clone())
    }

    /// Gets details about a Network Connectivity Center spoke.
    pub fn get_spoke(&self) -> super::builder::hub_service::GetSpoke {
        super::builder::hub_service::GetSpoke::new(self.inner.clone())
    }

    /// Creates a Network Connectivity Center spoke.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_spoke(&self) -> super::builder::hub_service::CreateSpoke {
        super::builder::hub_service::CreateSpoke::new(self.inner.clone())
    }

    /// Updates the parameters of a Network Connectivity Center spoke.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_spoke(&self) -> super::builder::hub_service::UpdateSpoke {
        super::builder::hub_service::UpdateSpoke::new(self.inner.clone())
    }

    /// Rejects a Network Connectivity Center spoke from being attached to a hub.
    /// If the spoke was previously in the `ACTIVE` state, it
    /// transitions to the `INACTIVE` state and is no longer able to
    /// connect to other spokes that are attached to the hub.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn reject_hub_spoke(&self) -> super::builder::hub_service::RejectHubSpoke {
        super::builder::hub_service::RejectHubSpoke::new(self.inner.clone())
    }

    /// Accepts a proposal to attach a Network Connectivity Center spoke
    /// to a hub.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn accept_hub_spoke(&self) -> super::builder::hub_service::AcceptHubSpoke {
        super::builder::hub_service::AcceptHubSpoke::new(self.inner.clone())
    }

    /// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn accept_spoke_update(&self) -> super::builder::hub_service::AcceptSpokeUpdate {
        super::builder::hub_service::AcceptSpokeUpdate::new(self.inner.clone())
    }

    /// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn reject_spoke_update(&self) -> super::builder::hub_service::RejectSpokeUpdate {
        super::builder::hub_service::RejectSpokeUpdate::new(self.inner.clone())
    }

    /// Deletes a Network Connectivity Center spoke.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_spoke(&self) -> super::builder::hub_service::DeleteSpoke {
        super::builder::hub_service::DeleteSpoke::new(self.inner.clone())
    }

    /// Gets details about a Network Connectivity Center route table.
    pub fn get_route_table(&self) -> super::builder::hub_service::GetRouteTable {
        super::builder::hub_service::GetRouteTable::new(self.inner.clone())
    }

    /// Gets details about the specified route.
    pub fn get_route(&self) -> super::builder::hub_service::GetRoute {
        super::builder::hub_service::GetRoute::new(self.inner.clone())
    }

    /// Lists routes in a given route table.
    pub fn list_routes(&self) -> super::builder::hub_service::ListRoutes {
        super::builder::hub_service::ListRoutes::new(self.inner.clone())
    }

    /// Lists route tables in a given hub.
    pub fn list_route_tables(&self) -> super::builder::hub_service::ListRouteTables {
        super::builder::hub_service::ListRouteTables::new(self.inner.clone())
    }

    /// Gets details about a Network Connectivity Center group.
    pub fn get_group(&self) -> super::builder::hub_service::GetGroup {
        super::builder::hub_service::GetGroup::new(self.inner.clone())
    }

    /// Lists groups in a given hub.
    pub fn list_groups(&self) -> super::builder::hub_service::ListGroups {
        super::builder::hub_service::ListGroups::new(self.inner.clone())
    }

    /// Updates the parameters of a Network Connectivity Center group.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_group(&self) -> super::builder::hub_service::UpdateGroup {
        super::builder::hub_service::UpdateGroup::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::hub_service::ListLocations {
        super::builder::hub_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::hub_service::GetLocation {
        super::builder::hub_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::hub_service::SetIamPolicy {
        super::builder::hub_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::hub_service::GetIamPolicy {
        super::builder::hub_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::hub_service::TestIamPermissions {
        super::builder::hub_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::hub_service::ListOperations {
        super::builder::hub_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::hub_service::GetOperation {
        super::builder::hub_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::hub_service::DeleteOperation {
        super::builder::hub_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::hub_service::CancelOperation {
        super::builder::hub_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Network Connectivity API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
/// let client = InternalRangeService::builder().build().await?;
/// // use `client` to make requests to the Network Connectivity API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The CLH-based service for internal range resources used to perform IPAM
/// operations within a VPC network.
///
/// # Configuration
///
/// To configure `InternalRangeService` use the `with_*` methods in the type returned
/// by [builder()][InternalRangeService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://networkconnectivity.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::internal_range_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::internal_range_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `InternalRangeService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `InternalRangeService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct InternalRangeService {
    inner: std::sync::Arc<dyn super::stub::dynamic::InternalRangeService>,
}

impl InternalRangeService {
    /// Returns a builder for [InternalRangeService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
    /// let client = InternalRangeService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::internal_range_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::internal_range_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::InternalRangeService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InternalRangeService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::InternalRangeService> {
        super::transport::InternalRangeService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::InternalRangeService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::InternalRangeService::new)
    }

    /// Lists internal ranges in a given project and location.
    pub fn list_internal_ranges(
        &self,
    ) -> super::builder::internal_range_service::ListInternalRanges {
        super::builder::internal_range_service::ListInternalRanges::new(self.inner.clone())
    }

    /// Gets details of a single internal range.
    pub fn get_internal_range(&self) -> super::builder::internal_range_service::GetInternalRange {
        super::builder::internal_range_service::GetInternalRange::new(self.inner.clone())
    }

    /// Creates a new internal range in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_internal_range(
        &self,
    ) -> super::builder::internal_range_service::CreateInternalRange {
        super::builder::internal_range_service::CreateInternalRange::new(self.inner.clone())
    }

    /// Updates the parameters of a single internal range.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_internal_range(
        &self,
    ) -> super::builder::internal_range_service::UpdateInternalRange {
        super::builder::internal_range_service::UpdateInternalRange::new(self.inner.clone())
    }

    /// Deletes a single internal range.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_internal_range(
        &self,
    ) -> super::builder::internal_range_service::DeleteInternalRange {
        super::builder::internal_range_service::DeleteInternalRange::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::internal_range_service::ListLocations {
        super::builder::internal_range_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::internal_range_service::GetLocation {
        super::builder::internal_range_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::internal_range_service::SetIamPolicy {
        super::builder::internal_range_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::internal_range_service::GetIamPolicy {
        super::builder::internal_range_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::internal_range_service::TestIamPermissions {
        super::builder::internal_range_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::internal_range_service::ListOperations {
        super::builder::internal_range_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::internal_range_service::GetOperation {
        super::builder::internal_range_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::internal_range_service::DeleteOperation {
        super::builder::internal_range_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::internal_range_service::CancelOperation {
        super::builder::internal_range_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Network Connectivity API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
/// let client = PolicyBasedRoutingService::builder().build().await?;
/// // use `client` to make requests to the Network Connectivity API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Policy-Based Routing allows GCP customers to specify flexibile routing
/// policies for Layer 4 traffic traversing through the connected service.
///
/// # Configuration
///
/// To configure `PolicyBasedRoutingService` use the `with_*` methods in the type returned
/// by [builder()][PolicyBasedRoutingService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://networkconnectivity.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::policy_based_routing_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::policy_based_routing_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `PolicyBasedRoutingService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `PolicyBasedRoutingService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct PolicyBasedRoutingService {
    inner: std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
}

impl PolicyBasedRoutingService {
    /// Returns a builder for [PolicyBasedRoutingService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
    /// let client = PolicyBasedRoutingService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::policy_based_routing_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::policy_based_routing_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::PolicyBasedRoutingService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PolicyBasedRoutingService> {
        super::transport::PolicyBasedRoutingService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PolicyBasedRoutingService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::PolicyBasedRoutingService::new)
    }

    /// Lists policy-based routes in a given project and location.
    pub fn list_policy_based_routes(
        &self,
    ) -> super::builder::policy_based_routing_service::ListPolicyBasedRoutes {
        super::builder::policy_based_routing_service::ListPolicyBasedRoutes::new(self.inner.clone())
    }

    /// Gets details of a single policy-based route.
    pub fn get_policy_based_route(
        &self,
    ) -> super::builder::policy_based_routing_service::GetPolicyBasedRoute {
        super::builder::policy_based_routing_service::GetPolicyBasedRoute::new(self.inner.clone())
    }

    /// Creates a new policy-based route in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_policy_based_route(
        &self,
    ) -> super::builder::policy_based_routing_service::CreatePolicyBasedRoute {
        super::builder::policy_based_routing_service::CreatePolicyBasedRoute::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single policy-based route.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_policy_based_route(
        &self,
    ) -> super::builder::policy_based_routing_service::DeletePolicyBasedRoute {
        super::builder::policy_based_routing_service::DeletePolicyBasedRoute::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::policy_based_routing_service::ListLocations {
        super::builder::policy_based_routing_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::policy_based_routing_service::GetLocation {
        super::builder::policy_based_routing_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::policy_based_routing_service::SetIamPolicy {
        super::builder::policy_based_routing_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::policy_based_routing_service::GetIamPolicy {
        super::builder::policy_based_routing_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::policy_based_routing_service::TestIamPermissions {
        super::builder::policy_based_routing_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::policy_based_routing_service::ListOperations {
        super::builder::policy_based_routing_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::policy_based_routing_service::GetOperation {
        super::builder::policy_based_routing_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::policy_based_routing_service::DeleteOperation {
        super::builder::policy_based_routing_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::policy_based_routing_service::CancelOperation {
        super::builder::policy_based_routing_service::CancelOperation::new(self.inner.clone())
    }
}
